package com.tarena.lbs.basic.web.service;

import com.tarena.lbs.basic.web.repository.BusinessCategoryRepository;
import com.tarena.lbs.pojo.basic.po.BusinessCategoryPO;
import com.tarena.lbs.pojo.basic.vo.BusinessCategoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class BizCategoryService {
    @Autowired
    private BusinessCategoryRepository businessCategoryRepository;
    public List<BusinessCategoryVO> list() {
        List<BusinessCategoryPO> pos = businessCategoryRepository.list();
        return pos.stream().map(po->{
            BusinessCategoryVO vo=new BusinessCategoryVO();
            BeanUtils.copyProperties(po,vo);
            return vo;
        }).collect(Collectors.toList());
    }
}
